import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import StepOne from '../views/StepOne.vue'
import StepTwo from '../views/StepTwo.vue'
import StepThree from '../views/StepThree.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: Home
    },
    {
      path: '/cart',
      meta: {
        flag: true
      },
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/Cart.vue')
    },
    {
      path: '/login',
      meta: {
        flag: true
      },
      component: () => import('../views/Login.vue')
    },
    {
      path: '/regist/step1',
      meta: {
        flag: true
      },
      component: StepOne,
    },
    {
      path: '/regist/step2',
      meta: {
        flag: true
      },
      component: StepTwo,
    },
    {
      path: '/regist/step3',
      meta: {
        flag: true
      },
      component: StepThree,
    },
    {
      path: '/details/:id',
      meta: {
        flag: true
      },
      component: () => import('../views/Details.vue')
    },
    {
      path: '/search',
      meta: {
        flag: true
      },
      component: () => import('../views/Search.vue')
    },
    {
      path: '/mine',
      meta: {
        flag: true
      },
      component: () => import('../views/Mine.vue')
    },
    {
      path: '/address',
      meta: {
        flag: true
      },
      component: () => import('../views/Address.vue')
    },
    {
      path: '/order',
      meta: {
        flag: true
      },
      component: () => import('../views/Order.vue')
    }
  ]
})

export default router
